package com.example.myapplication;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;

public class MusicActivity3 extends AppCompatActivity {
    Button Button1,Button2;
    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d("crq","MyService");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music);
        Button1=findViewById(R.id.button6);
        Button2=findViewById(R.id.button7);
        Intent intent=new Intent(this, MyService.class);
        Button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startService(intent);
            }
        });
        Button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                stopService(intent);
            }
        });
    }
    @Override
    protected void onStart() {
        Log.d("crq","2:onstart");
        super.onStart();
    }

    @Override
    protected void onStop() {
        Log.d("crq","2:onstop");
        super.onStop();
    }

    @Override
    protected void onRestart() {
        Log.d("crq","2:onrestart");
        super.onRestart();
    }

    @Override
    protected void onResume() {
        Log.d("crq","2:onresume");
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        Log.d("crq","2:ondestory");
        super.onDestroy();
    }

    @Override
    protected void onPause() {
        Log.d("crq","2:onpause");
        super.onPause();
    }
}